// pages/index/zhiwei/zhiwei.js
import ajax from "../../../utils/ajax.js";
let app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    list: [],
    district: "定位中...",
    settlementType: [],//结算方式
    wageType: [],//工资类型
    partTimeType: [],//兼职类型
    region: ['广东省', '广州市', '海珠区'],
    now_city: {
      name: '定位中'
    },
    banners: '',
    job_num: '',
    page_view: '',
    user_num: ''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    init_this_city_data() {
      // console.log(app.common.now_city);
      this.setData({ now_city: app.common.now_city })
    },
    init_zhiwei_data() {
      // 获取兼职列表
      ajax.get({
        url: 'parttime_jobs',
        data: {
          district: app.common.now_city.id,
        }
      }).then(res => {
        // console.log(res);
        if (res.code == 0) {
          this.setData({ list: res.data.list_data })
        }
      })
      // 获取兼职数据 获取兼职banner
      ajax.get({
        url: 'parttime_jobs/data',
      }).then(res => {
        console.log(res);
        this.setData({
          banners: res.data.images,
          job_num: res.data.job_num,
          page_view: res.data.page_view,
          user_num: res.data.user_num
        })
      })
    }
  },
  attached() {
    this.init_this_city_data();
    this.init_zhiwei_data();
  },
  signUp: function (e) {
    let id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '../detail/index?id=' + id,
    })
  }
})
